/*******************************************************************************
  ARTICLE	GAY, GOBBI, GONI (2025) "REVOLUTIONARY TRANSITIONS. INHERITANCE    
            CHANGE AND FERTILITY DECLINE" JOURNAL OF POLITICAL ECONOMY         
                                                                               
  AUTHORS	VICTOR GAY, PAULA GOBBI, MARC GONI                                 
  CONTACT	victor.gay@tse-fr.eu; paula.eugenia.gobbi@ulb.be; marc.goni@uib.no 
  VERSION	1.0 (MAY 2025)                                                     
  SOFTWARE	STATA SE 18                                                        
  LICENCE	MIT                                                                
--------------------------------------------------------------------------------

HENRY DATA PREPARATION DO FILE

This file combines the Henry and inheritance data and generates the final dataset for analysis.

Instructions: 
-------------
	gain access to Henry nominatif database and place enfants.sas7bdat and parents.sas7bdat in folder \1_raw_data\1_1_henri\ (see README for more details); 
 
	open do-files from directory where they are placed; order matters; run whole code.

Do-file structure: 
------------------
	0. PROGRAM SETUP
	1. HENRY NOMINATIVE - ENFANTS DATABASE
	2. HENRY NOMINATIVE - PARENTS' DATABASE
	3. GENERATE OTHER FERTILITY VARIABLES
	4. INHERITANCE VARIABLES
	5. TREATMENT VARIABLES
	6. RELIGIOSITY INDEX BASED ON LENT AND ADVENT MARRIAGES
	7. OTHER VARIABLES (aggregate health controls, distance to paris, political societies, rebellions)
	8. SAVE FINAL DATA

Main sources: 
-------------
	Enquête Henry Nominatif data base, parents and children (Seguy, 2001)
	Geolocated communes Henry (own collection)
	Inheritance customs (own collection)
		 
Other sources: 
--------------
	Wheat prices (Ridolfi)
	Population density (Cristofoli et al., 2021; IGN, 2021)
	Administrative centers (Nordman, Ozouf-Marignier, and Laclau, 1989 pp. 74–80)
	Political societies (Boutier, Boutry, and Bonin, 1992, pp. 77–101)
	Cassini road (Perret, Gribaudi, and Barthelemy, 2015)
	Rebellions (Nicolas 2002; Gay 2025)
	Horse-post network (Albertus and Gay, 2025)
	Caloric suitability (Galor and Ozak, 2016)
	Ruggedness (Nunn and Puga, 2012)
	Soil texture (INRA, 1998)
	Easter dates (https://tlarsen2.tripod.com/thomaslarsen/easterdates.html#Index) (accessed 13.10.2021)
		 
*/
********************************************************************************

********************
* 0. PROGRAM SETUP *
********************

version 18
clear all
set more off

************************
* PACKAGE DEPENDENCIES *
************************

net install tabmiss, from(https://stats.oarc.ucla.edu/stat/stata/ado/analysis/)

timer on 1

* ==============================================================================
* 1. HENRY NOMINATIVE - ENFANTS DATABASE
* ------------------------------------------------------------------------------

import sas using "../../1_raw_data/1_1_henri/enfants.sas7bdat"

* NET FERTILITY
// Children's age at death
gen chdage = AN_DE_EN-AN_NA_EN	
replace chdage=. if AN_DE_EN==0 | AN_NA_EN==9999 
replace chdage=. if AN_DE_EN<AN_NA_EN 
// Infant mortality
gen infmort=1 if chdage<6 
bys N0_FICH NENF: egen tot_mort=sum(infmort)
// Net fertility
gen nfert=NENF-tot_mort
// Cummins (2020) adjustment to child mortality
gen missdeath = (AN_DE_EN==9999 | AN_DE_EN==0 | AN_DE_EN==.)	// missing death record 
bys N0_FICH NENF PR_ENF: gen rep_pre = (_N>1)					// repeated 3 letters of first forename
gen rep_pre_mis = (rep_pre==1 & missdeath==1)					// repeated 3 letters + missing death record
bys N0_FICH NENF: egen NRN=sum(rep_pre_mis)						// total by parent union (NRN)
gen nfert_adj = NENF-tot_mort if NRN==0						// adjusted net fertility
replace nfert_adj = NENF-tot_mort-NRN if NRN>0
* same as before but removing children dying before age 14 (as in Cummins 2020)
gen infmortadj=1 if chdage<14 
bys N0_FICH NENF: egen tot_mort14=sum(infmortadj)
gen nfert14=NENF-tot_mort14
gen nfert_adj14 = NENF-tot_mort14 if NR==0						
replace nfert_adj14 = NENF-tot_mort14-NR if NR>0

* GROSS FERTILITY
gen fert_gross = NENF 

* YEAR FIRST AND LAST BIRTH
// Children's birth year
gen chbyear = AN_NA_EN
replace chbyear=. if AN_NA_EN==9999
// Birth year of first child
sort N0_FICH NENF chbyear
by N0_FICH NENF: gen fbyear=chbyear[1]
// Birth year of last child
sort N0_FICH NENF chbyear
by N0_FICH NENF: gen lbyear=chbyear[_N]
tabmiss lbyear
bys N0_FICH NENF: replace lbyear=chbyear[_N-1] if chbyear[_N]==.
tabmiss lbyear
// Birth year of first surviving child
sort N0_FICH NENF infmort chbyear
by N0_FICH NENF infmort: gen fsbyear=chbyear[1]
replace fsbyear = . if infmort==1
// Birth year of last child
sort N0_FICH NENF infmort chbyear
by N0_FICH NENF infmort: gen lsbyear=chbyear[_N]
by N0_FICH NENF infmort: replace lsbyear=chbyear[_N-1] if chbyear[_N]==.
replace lsbyear = . if infmort==1

* SAVE TEMP FILE
collapse nfert nfert_adj nfert14 nfert_adj14 fert_gross fbyear lbyear fsbyear lsbyear, by(N0_FICH NENF)
order N0_FICH NENF nfert nfert_adj nfert14 nfert_adj14 fert_gross fbyear lbyear fsbyear lsbyear
label var N0_FICH "Fiche identifier (1/2)"
label var NENF "Fiche identifier (2/2)"
label var nfert "Net completed fertility (births surv age 6)"
label var nfert_adj "Adjusted net completed fertility (births surv age 6) [Cummins 2020]"
label var nfert14 "Net completed fertility (births surv age 14)"
label var nfert_adj14 "Adjusted net completed fertility (births surv age 14) [Cummins 2020]"
label var fert_gross "Gross completed fertility"
label var fbyear "Year first birth"
label var lbyear "Year last birth"
label var fsbyear "Year first birth surv age 6"
label var lsbyear "Year last birth surv age 6"
tempfile enfants0
save `enfants0', replace


* ==============================================================================
* 2. HENRY NOMINATIVE - PARENTS' DATABASE
* ------------------------------------------------------------------------------

import sas using "../../1_raw_data/1_1_henri/parents.sas7bdat", clear

* HOUSEKEEPING
// duplicated observation with missing birth years for both spouses
drop if N0_FICH==30900 & AN_NA_MA==9999 & AN_NA_FE==9999 

* MERGE PARENTS AND CHILDREN HENRY NOMINATIVE DATA
merge 1:1 N0_FICH NENF using `enfants0', nogen
* Add 0 children to net and gross fertility
replace fert_gross = NENF if fert_gross==.
replace nfert = 0 if NENF==0
replace nfert_adj = 0 if NENF==0
replace nfert14 = 0 if NENF==0
replace nfert_adj14 = 0 if NENF==0
	/* Note: since these variables were calculated from the enfants dataset, by
		construction gross fertility was >0 (i.e., childless couples are not
		recorded in enfants database)	*/

		
* ==============================================================================
* 3. GENERATE OTHER FERTILITY VARIABLES
* ------------------------------------------------------------------------------

* Completed fertility of mothers
gen intmarg = nfert
replace intmarg = . if nfert==0
label var intmarg "Net completed fertility of mothers (births surv age 6)"

* Childlesness
gen chdls = (nfert==0)
replace chdls = . if nfert==.
label var chdls "Childlessness (0/1) (births surv age 6)"

* Adjusted intensive margin and childlessness [Cummins 2020]
gen intmargadj = nfert_adj
replace intmargadj = . if nfert_adj==0
gen chdlsadj = (nfert_adj==0)	
label var intmargadj "Adjusted net completed fertility of mothers (births surv age 6) [Cummins 2020]"
label var chdlsadj "Adjusted childlessness (0/1) (births surv age 6) [Cummins 2020]"

* Woman's birth year
gen byear=AN_NA_FE
replace byear=. if byear==9999
replace byear=. if byear==0
label var byear "Birth year (wom.)"

* Age at marriage
gen mage = AN_MA-byear
replace mage = . if mage<15 & mage>50
label var mage "Age at marriage (wife)"

* Age at first birth (mothers)
gen fbage = fbyear-byear
replace fbage = . if fbage<12 | fbage>56
label var fbage "Wife's age at first birth"

* Age at first survivig birth (mothers)
gen fsbage = fsbyear-byear
replace fsbage = . if fsbage<12 | fsbage>56
label var fsbage "Wife's age at first birth surv 6"

* Age at last birth (mothers)
gen lbage = lbyear-byear
replace lbage = . if lbage<12 | lbage>56
label var lbage "Wife's age at last birth"

* Time to first birth
gen TFB = fbyear-AN_MA
replace TFB = 0 if TFB<0
label var TFB "Time to first birth (years)"

* Wife's age at death
gen dage = AG_DE_FE
replace dage = . if AG_DE_FE==0 | AG_DE_FE==99
label var dage "Age at death (wife)"

* Husband's age at death
gen sdage = AG_DE_MA
replace sdage = . if AG_DE_MA==0 | AG_DE_MA==99
label var sdage "Age at death (husband)"

* Span between first and last birth
gen rspan = lbyear-fbyear
replace rspan = 0 if rspan<0
replace rspan = . if dage<40 | sdage<40
label var rspan "Span between first and last birth (years)"

* Birth spacing (minimum)
preserve 
import sas using "../../1_raw_data/1_1_henri/enfants.sas7bdat", clear
gen chdage = AN_DE_EN-AN_NA_EN	// Children's age at death
replace chdage=. if AN_DE_EN==0 | AN_NA_EN==9999 
replace chdage=. if AN_DE_EN<AN_NA_EN 
gen infmort=1 if chdage<6 // Infant mortality
drop if AN_NA_EN==9999 | infmort==1
sort N0_FICH NENF AN_NA_EN
by N0_FICH NENF: gen binterval = AN_NA_EN-AN_NA_EN[_n-1]
replace binterval = . if binterval>20
keep N0_FICH NENF binterval
collapse (max) binterval, by(N0_FICH NENF)
tempfile enfants1
save `enfants1', replace
restore
merge 1:1 N0_FICH NENF using `enfants1', keep(mas mat) nogen
replace binterval = . if dage<40 | sdage<40 | nfert<2
label var binterval "Birth spacing (minimum)"

		
* ==============================================================================
* 5. INHERITANCE VARIABLES
* ------------------------------------------------------------------------------

preserve
import delimited "../../1_raw_data/1_1_henri/henri_controls.csv", clear 
tostring villagenum, replace // to merge later on
replace villagenum = "02110213" if villagenum=="2110213"
replace villagenum = "06125026" if villagenum=="6125026"
replace villagenum = "08124121" if villagenum=="8124121"
tostring insee_com, replace
replace insee_com = "02213" if insee_com=="2213"
replace insee_com = "06026" if insee_com=="6026"
replace insee_com = "08121" if insee_com=="8121"  
gen text1_cat0 = 1 if text1_cat=="Coarse"
replace text1_cat0 = 2 if text1_cat=="Medium"
replace text1_cat0 = 3 if text1_cat=="Medium fine"
replace text1_cat0 = 4 if text1_cat=="Fine"
label define text1_cat_lbl 1 "Coarse" 2 "Medium" 3 "Medium fine" 4 "Fine", replace
label values text1_cat0 text1_cat_lbl
drop text1_cat
rename text1_cat0 text1_cat
save "../2_0_tempfiles/henri_controls.dta", replace
restore
gen villagenum = VILLAGE
merge m:1 villagenum using "../2_0_tempfiles/henri_controls.dta", nogen keep(mas mat)

* Impartible & women excluded indicators
gen impart = 1-partible
gen womexc = 1-fem_included
rename fem_included wominc

// Variable labels
label var partible "Partible inheritance before 1793 reforms [Gay, Gobbi, Goñi 2023]"
label var impart "Impartible inheritance before 1793 reforms [Gay, Gobbi, Goñi 2023]"
label var womexc "Women excluded from inheritance before 1793 reforms [Gay, Gobbi, Goñi 2023]"
label var wominc "Women included in inheritance before 1793 reforms [Gay, Gobbi, Goñi 2023]"


* ==============================================================================
* 6. TREATMENT VARIABLES
* ------------------------------------------------------------------------------

* Affected v. not affected by the reform
gen affected = (impart==1 | womexc==1)
replace affected = . if impart==.
replace affected = . if womexc==.
label var affected "Affected by 1793 inheritance reforms [Gay, Gobbi, Goñi 2023]"

* Fertile years (ages 15-35) after 1793 reforms
local fage = 40
local tage = 40-15
gen T = 0 if 1793-byear>40
forvalues i=0/`tage'{
replace T = `i' if 1793-byear==40-`i'
}
replace T = `tage' if 1793-byear<15
replace T = .  if byear==.
label var T "Years fertile post-1793 reform"

* Dichotomous fertility exposure
gen T01 = (T>0)
replace T01 = . if T==.
label var T01 "Fertile post-reform (0/1)"

* Reformed inheritance x fertile post-reform
gen T01xaffected = affected*T01
label var T01xaffected "Reformed inheritance x fertile post-reform"

* Labels for covariates
label var dist_socpol "Distance to nearest political society (km) [Boutier et al. 1992]"
label var dist_eveche "Distance to nearest évêché capital (km) [Nordman et al. 1989]"
label var dist_recette "Distance to nearest recette des finances capital (km) [Nordman et al. 1989]"
label var dist_subdeleg "Distance to nearest subdélégation capital (km) [Nordman et al. 1989]"
label var dist_bailliage "Distance to nearest bailliage capital (km) [Nordman et al. 1989]"
label var dist_cassini "Distance to nearest Cassini road in 1750-90 (km) [Perret et al. 2015]"
label var dist_post "Distance to nearest horse-post relay in 1790 (km) [Albertus and Gay 2025]"
label var dist_jacobins "Distance to closest Jacobin political society (km)"
label var dist_cheflieu "Distance to closest administrative center (km)"
label var dist_district "Distance to closest district chef-lieu (km)"
label var dist_dep  "Distance to closest département chef-lieu (km)"
label var dist_rebellio~l "Distance to closest rebellion 1661-1789 (km)"
label var dis~l_1749_1789 "Distance to closest rebellion 1749-1789 (km)"
label var dis~l_1779_1789 "Distance to closest rebellion 1779-1789 (km)"
label var dist_rebellio~e "Distance to closest rebellion against the state 1661-1789 (km)"
label var dis~e_1749_1789 "Distance to closest rebellion against the state 1749-1789 (km)"
label var dis~e_1779_1789 "Distance to closest rebellion against the state 1779-1789 (km)"
*
label var pw1700 "Average wheat price in sous per liter in 1700-1709"
label var pw1710 "Average wheat price in sous per liter in 1710-1719"
label var pw1720 "Average wheat price in sous per liter in 1720-1729"
label var pw1730 "Average wheat price in sous per liter in 1730-1739"
label var pw1740 "Average wheat price in sous per liter in 1740-1749"
label var pw1750 "Average wheat price in sous per liter in 1750-1759"
label var pw1760 "Average wheat price in sous per liter in 1760-1769"
label var pw1770 "Average wheat price in sous per liter in 1770-1779"
label var pw1780 "Average wheat price in sous per liter in 1780-1789"
label var pw1790 "Average wheat price in sous per liter in 1790-1799"
*
label var area "Area in km2"
label var pop_1793 "Population in 1793"
label var density_1793 "Population density in 1793 (pop by km2)"
label var ldensity_1793 "Log population density in 1793"
label var text1 "Weighted average soil texture of dominant surface"
*
label var avcalmean "Post-1500 average caloric suitability [Galor and Ozak 2016]"

* ==============================================================================
* 7. RELIGIOSITY INDEX BASED ON LENT AND ADVENT MARRIAGES
* ------------------------------------------------------------------------------

* LENT DATES
* ----------------
// Import Easter dates (catholique, modern calendar) 
	* Source: https://tlarsen2.tripod.com/thomaslarsen/easterdates.html#Index (accessed 13.10.2021)
preserve 
import delimited "../../1_raw_data/1_17_easter_dates/Easter-dates-1700-1819.txt", clear
rename eyear AN_MA
tempfile easterdates
save `easterdates', replace
restore 
merge m:1 AN_MA using `easterdates', nogen
gen eday2 = substr(eday, 1,length(eday)-2)	// remove st, nd, rd, th from day
destring eday2, replace
gen emonth2 = 3 if emonth=="March"			// destring month names
replace emonth2 = 4 if emonth=="April"
gen edate = mdy(emonth2, eday2, AN_MA)
drop emonth eday emonth2 eday2

// Ash wednesday dates
gen ashdate = edate-46

* ADVENT DATES
* ----------------
// Advent Sunday
	* Note: Advent Sunday is the Sunday that falls on or closest to 30 November
gen advdate = .
replace advdate = mdy(11, 30, AN_MA) if dow(mdy(11, 30, AN_MA))==0	// 30 November is a Sunday
replace advdate = mdy(11, 29, AN_MA) if dow(mdy(11, 30, AN_MA))==1	// 30 November is a Monday
replace advdate = mdy(11, 28, AN_MA) if dow(mdy(11, 30, AN_MA))==2	// 30 November is a Tuesday
replace advdate = mdy(11, 27, AN_MA) if dow(mdy(11, 30, AN_MA))==3	// 30 November is a Wednesday
replace advdate = mdy(12, 3, AN_MA)  if dow(mdy(11, 30, AN_MA))==4	// 30 November is a Thursday
replace advdate = mdy(12, 2, AN_MA)  if dow(mdy(11, 30, AN_MA))==5	// 30 November is a Friday
replace advdate = mdy(12, 1, AN_MA)  if dow(mdy(11, 30, AN_MA))==6	// 30 November is a Saturday

// Christmas
gen chmasdate = mdy(12, 25, AN_MA)

* MARRIAGE DATES
* ----------------
* Marriage date
gen mdate = mdy(MOIS_MA, JOUR_MA, AN_MA) if MOIS_MA!=99 & JOUR_MA!=99 & AN_MA!=.
format edate ashdate mdate %d
label var mdate "Marriage date"
* Married during Lent
gen mlent = (mdate>=ashdate & mdate<=edate)
replace mlent = . if MOIS_MA==99 | JOUR_MA==99 | AN_MA==.
* Married during Advent
gen madvent = (mdate>=advdate & mdate<=chmasdate)
replace madvent = . if MOIS_MA==99 | JOUR_MA==99 | AN_MA==.
* Married during Lent or Advent
gen mcivil = madvent+mlent


* INDEX BY VILLAGE
* ----------------
/*	Note: marriage index is 
	I_(j,t) = [N Lent & Advent marriages_(j,t) / N all marriages_(j,t)]  x  
				[365.25 / days Lent & Advent_(t)]
*/
gen lengthadvent = chmasdate-advdate
* N marriages (lent, advent, all) 
gen mall = 1 if AN_MA!=.
foreach x in all advent lent civil{
gen m`x'2 = m`x' if AN_MA>=1792 & AN_MA<=1815
bys villagenum AN_MA: egen t`x' = sum(m`x')  
bys villagenum AN_MA: egen t`x'_post1792 = sum(m`x'2) 
}
* Index for all years, by village and year
gen idxlent   = (tlent/tall)*(365.25/46)
gen idxadvent = (tadvent/tall)*(365.25/lengthadvent)
gen idxcivil  = ((tlent+tadvent)/tall)*(365.25/(46+lengthadvent))
* Index for post 1792 years, by village and year
gen idxlent_post1792 = (tlent_post1792/tall_post1792)*(365.25/46)
gen idxadvent_post1792 = (tadvent_post1792/tall_post1792)*(365.25/lengthadvent)
gen idxcivil_post1792 = ((tlent_post1792+tadvent_post1792)/tall_post1792)*(365.25/(46+lengthadvent))
* Index for post 1792 years, by village (i.e., cross-sectional)
foreach x in all advent lent civil{
bys villagenum: egen v`x' = sum(m`x'2)
drop m`x'2  
}
bys villagenum: egen vlengthadvent = mean(lengthadvent)
gen vidxlent   = (vlent/vall)*(365.25/46)
gen vidxadvent = (vadvent/vall)*(365.25/vlengthadvent)
gen vidxcivil  = ((vlent+vadvent)/vall)*(365.25/(46+ vlengthadvent))

drop vlengthadvent vall vadvent vlent vcivil idxlent_post1792 idxadvent_post1792 idxcivil_post1792 tall tadvent tlent tcivil chmasdate advdate mlent madvent mcivil ashdate lengthadvent mall tall_post1792 tadvent_post1792 tlent_post1792 tcivil_post1792 edate mdate 

label var idxlent "Religiosity index based on lent marriages, by municipality and year"
label var idxadvent "Religiosity index based on advent marriages, by municipality and year" 
label var idxcivil "Religiosity index based on lent and advent marriages, by municipality and year"
label var vidxlent "Avg. religiosity index based on lent marriages, by municipality"
label var vidxadvent "Avg. religiosity index based on advent marriages, by municipality"
label var vidxcivil "Avg. religiosity index based on lent and advent marriages, by municipality"


* ==============================================================================
* 8. OTHER VARIABLES
* ------------------------------------------------------------------------------

* DISTRIBUTION FACTORS
* --------------------
* Distribution factors determining women's bargaining power in the household (for Table A10)
// relative age
gen relage = AN_NA_FE - AN_NA_MA
replace relage = . if AN_NA_MA==0 | AN_NA_MA==9999 | AN_NA_FE==0 | AN_NA_FE==9999
replace relage = . if !inrange(relage,-30,30) // drop extreme values
label var relage "Relative age (husband vs wife)"
// relative literacy
gen reledu = (SI_MA_MA==SI_MA_FE)
replace reledu = . if SI_MA_MA==. | SI_MA_FE==.
label var reledu "Relative literacy (=1 same)"

* LONGEVITY VARIABLES
* -------------------
* = 1 if women died before 40
gen d40 = (dage<40)
label var d40 "Wife died before 40 (=1 yes; 0=no)"

* Decade variables

* Average women's longevity by village by decade:
egen decade0 = cut(byear), at(1600(10)1810)
bys villagenum decade0: egen avlong = mean(dage)
label var avlong "Average longevity of women, by village and decade"

* Probability women died before 40 by village by decade:
bys villagenum decade0: egen prob40 = mean(d40)
label var prob40 "Share women dying before 40, by village and decade"
drop decade0
	
* DISTANCE VARIABLES
* ------------------
* log-distances
foreach v of varlist dist*{
	gen l`v' = log(1+`v')
	local y: variable label `v'
	label var l`v' "log 1 + `y'"
}

* WHEAT PRICES
* ------------
gen year15 = byear+15
gen pwheat_age15 = pw1710 if year15>=1710 & year15<=1719
forvalues t=1720(10)1790{
local t2=`t'+9
replace pwheat_age15 = pw`t' if year15>=`t' & year15<=`t2'
}
replace pwheat_age15 = pw1790 if year15>=1790 & year15!=.
* in logs
gen logpwheat = log(pwheat_age15)
label var pwheat_age15 "Wheat price in decade when women turned 15"
label var logpwheat "Wheat price in decade when women turned 15 (in logs)"
drop year15
* Pre-reform wheat price
gen prewheat = log(pw1780)
label var prewheat "Pre-reform wheat price (in logs)"
	
destring villagenum, replace
	
* lables and order
label var insee_com "Municipality INSEE code"
label var villagenum "Municipality Identifier"
label var villagename "Municipality name"
label var latitude "Municipality latitude"
label var longitude "Municipality longitude"
label var TYP_FICH "Type of Henry form (accuracy)"
label define lbl_typ 11	"date naissance femme réelle" 12 "naissance femme calculée selon age mariage" 13 "naissance femme calculée selon age décès" 14 "date naissance femme blanche" 15 "naissance femme calculée selon RGP" 21 "date naissance femme réelle" 22 "naissance femme calculée selon age mariage" 23 "naissance femme calculée selon age décès" 24 "date naissance femme blanche" 25 "naissance femme calculée selon RGP", replace
label values TYP_FICH lbl_typ
label var ruggedness "Terrain ruggedness [Nunn, Puga 2012]"
label var sh_sandy "Share of sandy soils"
label var SU_PE_MA "Survival of husband's father"
label var SU_ME_MA "Survival of husband's mother"
label var SU_PE_FE "Survival of wife's father"
label var SU_ME_FE "Survival of wife's mother"
label define lbl_su 0 "p+m ()" 1 "surv" 2 "mort" 3 "père inconnu, enf illégitime" 4 "parents inconnus, enfant trouvé" 9 "aucune indication"
label values SU_* lbl_su
label var SI_MA_FE "Literacy (1 = signed marriage cetificate, 0 otherwise)"
label var SI_MA_MA "Literacy of husband (1 = signed marriage cetificate, 0 otherwise)"
label var JOUR_MA "Day of marriage"
label var MOIS_MA "Month of marriage"
label var AN_MA "Year of marriage"
label var AN_NA_MA "Birth year of husband"
label var AN_NA_FE "Birth year of wife" 

	
* ==============================================================================
* 9. SAVE FINAL DATA
* ------------------------------------------------------------------------------

drop VILLAGE village_name id_villagenum country NO_MA PR_MA PR_PE_MA P_PE_MA NO_ME_MA PR_ME_MA P_ME_MA PR_CO_MA P_MA NO_CO_MA P_CO_MA NO_FE PR_FE PR_PE_FE P_PE_FE NO_ME_FE P_FE PR_ME_FE P_ME_FE PR_CO_FE NO_CO_FE P_CO_FE LI_NA_MA LI_RE_MA AVT_MA AP_MA LI_NA_FE LI_RE_FE AVT_FE AP_FE AN_FIN JOUR_REM MOIS_REM AN_REM RG_MA_MA AG_MA_MA JR_NA_MA JR_DE_MA JR_NA_FE JR_DE_FE PAREN_MA PAREN_FE MS_NA_MA MS_NA_FE MS_DE_MA MS_DE_FE AN_DE_MA AG_DE_MA JOUR_FIN MOIS_FIN RG_MA_FE AG_MA_FE AN_DE_FE AG_DE_FE

save "../../3_outputs/3_1_datasets/final-henry.dta", replace

timer off 1 /* 1.06 seconds */
timer list
